<?php
	require_once "includes/pagination.php";
	$itemPerPage=10;
	if($_SESSION['user_id_sess']=="") {
		echo "<script type='text/javascript'> window.location='index.php?signin&url=mylist'; </script>";
	}
	$userId = $_SESSION['user_id_sess'];
	//delete single product		 
			if(!empty($_POST['hidDelPro'])) {
				$proId=$_POST['hidDelPro'];
				$delType=$_POST['hidDelProKey'];
				if($delType=='prod')
				   $sqlDelPro="Delete from tbl_product where product_id=$proId";
				else if($delType=='item')
				   $sqlDelPro="Delete from tbl_items where item_id = $proId";
				$rstDelPro=mysql_query($sqlDelPro);
				if($rstDelPro) { 
					//$imgPaths=getImagePath($proId);
					//if($imgPaths[0]!="") { unlink($imgPaths[0]); }
					//if($imgPaths[1]!="") { unlink($imgPaths[1]); }
					//if($imgPaths[2]!="") { unlink($imgPaths[2]); }
					echo "<div id='suc-msg'> Your product deleted. </div><br>"; 
				}	
				else {
					echo "<div id='err-msg'> Your product could not be deleted. </div><br>";
				}
			}
			if(isset($_REQUEST['post_id']))
			{
			      $futureTime = mktime(0, 0, 0, date('m'), date('d')+30, date('Y'));
			      $d=date('Y-m-d h:i:s',$futureTime);
			     // $curtime=date("Y-m-d h:i:s");
			      $rs=mysql_query("update tbl_items set bargain_duration='$d' where item_id='".$_REQUEST['post_id']."'");
			      ?>
			      <script language="javascript">
			      $(document).ready(function() {
				var ntop = (( $(window).height() - $('#relist_cf_<?php echo $_REQUEST['post_id']?>').height()) / 2+$(window).scrollTop()) - 100;
				var nleft = ( $(window).width() - $('#relist_cf_<?php echo $_REQUEST['post_id']?>').width()) / 2+$(window).scrollLeft();
			       //alert(ntop+' '+nleft);
				$('#del_inventory_cf1').css({'left': '', 'top':ntop});
				$('#del_inventory_cf1').fadeIn('slow');
			      });
			        // $("#del_inventory_cf1").show();
			      </script>
			      <?php
			}
			//check for total 10 transactions
			
			$seltrans="select * from tbl_items_code where isSold=1 AND (sell_by='".$_SESSION['user_id_sess']."' OR buy_by='".$_SESSION['user_id_sess']."'";
			$rstrans=mysql_query($seltrans);
			$notrans=mysql_num_rows($rstrans);
?>
<script>
function show_more_infop()
{
  var ntop = ( $(window).height() - $('#more_infop').height() ) / 2+$(window).scrollTop();
  var nleft = ( $(window).width() - $('#more_infop').width() ) / 2+$(window).scrollLeft();

  $('#more_infop').css({'left': nleft, 'top':ntop});
  $('#more_infop').fadeIn('slow');
}
</script>
<div style=" display: none; width: 400px; font-weight:bold; padding:10px; background-color:#cccccc; opacity:0.9;" class="user_popup" id="more_infop">
  <span style="float:left; width:100%; text-align:right; margin-bottom:5px;"><label style="cursor:pointer;" onclick="$('#more_infop').fadeOut('slow');">x</label></span>
  <span style="float:left; width:100%; margin-bottom:10px;" id="desc_info"> In this inventory you are selling products for others, in return for a commission. Add products you wish to sell and they will appear within your seller store for sale. Tip: spread the word out to friends, family, and other connections to gain sales, just provide them with your store link. By also spreading the word you can receive referral commission on top of the sale </span>
</div>
<div id='panel'>
	 <?php require_once "own_products_own.php"; ?>
</div>
<br />

<?
   $sqlSelPro="SELECT * FROM tbl_product where posted_by='$userId' and sell_by=0 ORDER BY product_id DESC";
	$rstSelPro=mysql_query(getPagingQuery($sqlSelPro,$itemPerPage));				  
	$notrans=mysql_num_rows($rstSelPro);
     
  //if($notrans>=10)
  //{
?>
	
<?
 // }
?>
<br />
<div class="popup_box" style="display:none; position:absolute; background:#FFFFFF;" id="del_inventory_cf"> 
      <div class="popup_box_in" style="height:120px;">
	  <div style="float:left; width:90%; padding:5px;">
	      If you choose to re-list this item,please be aware that if any information has been<br />
	      changed by the ownere the product,since you originally picked up the product<br />
	      your re-list will reflect those changes.
	  </div>
	  <div style="float:left; width:98%; padding:5px;">
	      <input type="button" name="" value="Close" class="refer_btn" style="margin:0px; height:30px; cursor:pointer;" onclick="javascript:$('#del_inventory_cf').hide();" />
			      &nbsp;&nbsp;&nbsp;&nbsp;
	      <input type="button" id="proceedbtn1" value="Proceed" class="yellow_btn"  style="float:none; height:30px; cursor:pointer;"/>
	  </div>
      </div>
  </div>
<script>
function show_cf_box(productId)
{
    var ntop = (( $(window).height() - $('#relist_cf_'+productId).height()) / 2+$(window).scrollTop()) - 100;
    var nleft = ( $(window).width() - $('#relist_cf_'+productId).width()) / 2+$(window).scrollLeft();

    $('#del_inventory_cf').css({'left': '', 'top':ntop});
    $('#del_inventory_cf').fadeIn('slow');
    $('#proceedbtn1').attr('onclick','window.location="index.php?mySwapen&post_id='+productId+'";');
}
  
</script>
<div class="popup_box1" style="display:none; position:absolute; background:#FFFFFF;" id="del_inventory_cf1"> 
      <div class="popup_box_in" style="height:100px;width:400px;">
	  <div style="float:left; width:90%; padding:15px;">
	     You have successfully re-listed your item for 30 days.
	  </div>
	  <div style="float:left; width:98%; padding-top:20px; padding-left:170px;">
	      <input type="button" name="" value="Close" class="refer_btn" style="margin:0px; height:30px; cursor:pointer;" onclick="javascript:$('#del_inventory_cf1').hide();" />
           </div>
      </div>
  </div>


<?php
if($_SESSION['user_type_sess']!=5)
{
?>
<div id='panel'>

	<div class="fulldiv" style="width:700px;">

	<div class="fulldiv" style="margin:10px 0px 0px 0px;">
 	<div style="float:left; margin:0px 10px 0px 10px; padding-top:8px;"><strong class="orangehead">Sell products FOR other users</strong></div>
	<div class="greyarrowsml" onclick="show_hide_s_boxes('sell_p_f_o_u')" id="arrow_sell_p_f_o_u">&nbsp;</div>
	
	<div class="fulldiv" style="width:49%; margin-top:13px; float:right;">
	<div class="star" style="float: right;" id="star_sell_p_f_o_u">&nbsp;</div>
	<a href="javascript:void(0)" class="bluelink" style="float: right;" onclick="show_more_infop()" id="more_info_sell_p_f_o_u">more info</a>
	</div>

<div id="sell_p_f_o_u">
<div class="fullbox_top">&nbsp;</div>
	<div class="fullbox_repeat">
	<table width="100%" border="0">
  
  <tr>
    <td>
		 <?php
		if(!empty($_POST['editSellingProductOtherKey'])) {
		$itemId=$_POST['editSellingProductOtherKey'];
		$commission=$_POST['commission'];
		$sqlSelItemUpd="SELECT * FROM tbl_items where item_id='$itemId'";
		$rstSelItemUpd=mysql_query($sqlSelItemUpd);			
		$rowSelItemUpd=mysql_fetch_array($rstSelItemUpd);	
		$commissionExist=$rowSelItemUpd['commission'];
		$priceExist=$rowSelItemUpd['price'];
		if($commission<$commissionExist)
		{
		$priceChange=$commissionExist-$commission;
		$priceNow=$priceExist-$priceChange;
		$sqlUpdSellingProd="UPDATE tbl_items SET commission='$commission', price='$priceNow' WHERE item_id=$itemId";
		$rstUpdSellingProd=mysql_query($sqlUpdSellingProd);
		$noUpdSellingProd=mysql_affected_rows();
		if($noUpdSellingProd>0){ 			
			echo "<div id='suc-msg'> Your selling Product edited. </div>"; 
		}
		else {
			echo "<div id='err-msg'> Error on editing selling product. </div>";
		}
	  }
	  else 
	    echo "<div id='err-msg'> You can only reduce your commission, you cant increase the commision. </div>";
	}
	
	
	
	//delete products selling for others
	if(!empty($_POST['delPro'])) {				
		$itemId=$_POST['delPro'];
		$itemType=$_POST['delProKey'];		
		if($itemType=='prod') {
		   $sqlDelSelPro="Delete from tbl_product where product_id=$itemId";
		} 
		else if($itemType=='item') {
		   $sqlDelSelPro="Delete from tbl_items where item_id = $itemId";
		   $sqlDelwishPro="Delete from tbl_wishlist where item_id='".$itemId."' and user_id='".$_SESSION['user_id_sess']."'";
		   $rstDelwishPro=mysql_query($sqlDelwishPro) or die(mysql_error());
		}		  
		$rstDelSelPro=mysql_query($sqlDelSelPro) or die(mysql_error());
		if(mysql_affected_rows()>0) { 					
			echo "<div id='suc-msg'> Your product deleted. </div><br>"; 
		}	
		else {
			echo "<div id='err-msg'> Your product could not be deleted. </div><br>";
		}
	}
	
	
	
		 ?>
		    <form name="frmProListOthers" id="frmProListOthers" method="post" action="">
		 	<input type="hidden" name="delPro" id="delPro">
            <input type="hidden" name="delProKey" id="delProKey">
            <input type="hidden" name="hidEditSellingItemothers" id="hidEditSellingItemothers">
<?php
		  		   $sqlSelItem="SELECT * FROM tbl_items where seller_id='$userId' AND owner_id!='$userId' ORDER BY item_id DESC";
				   //echo $sqlSelItem;
				   $rstSelItem=mysql_query(getPagingQuery($sqlSelItem,$itemPerPage));				
				   $noSelItem=mysql_num_rows($rstSelItem);
				   if($noSelItem==0)
				   {
					?>
					 <table width='100%' border='0' align='center' cellspacing='0'>
						<tr>
						  <td colspan="15" align="center">
						    <div class="box" style="float:none;">
							<div class="box_top">&nbsp;</div>
							<div class="box_middle">
							    <div class="boxtxt_out">&nbsp;</div>
							    <div class="boxtxt_out"><em>Want to make money by selling other users products?</em></div>
							    <div class="boxtxt_out">
							      <div class="box_img">
								      <img src="images/starthere_blue.png" style="cursor:pointer;" onclick="window.location='index.php?addProduct'" />
							      </div>
							    </div>
							</div>
							<div class="box_bottom">&nbsp;</div>
						    </div>
						  </td>
						</tr>
					    </table>
					 <?php
					}
				   else {	?>
						<div style="float: left; width: 660px; border-bottom:2px solid #ccc;">
							
							<div style="width: 22px; text-align:center;" class="cell_head">#</div>
							<div style="width: 90px; text-align:center;" class="cell_head">Product Name</div>
							<div style="width: 70px; text-align:center;" class="cell_head">Condition</div>
							<div style="width: 50px; text-align: center;" class="cell_head">Pick Up</div>
							<div style="width: 30px; text-align: center;" class="cell_head">Qty</div>
							<div style="width: 80px; text-align: center;" class="cell_head">Commission</div>
							<div style="width: 57px; text-align: center;" class="cell_head">Shipping</div>
							<div style="width: 57px; text-align: center;" class="cell_head">Price</div>
							<div style="width: 105px; text-align: center;" class="cell_head">Time Left</div>
							<div style="width: 45px; text-align: center;" class="cell_head">&nbsp;</div>
						</div>
				   		  
						<div style="max-height:190px; float:left; width:660px; overflow-y:auto;">
						
						 <?php
						 $r=1;
						 
						 while($rowSelItem=mysql_fetch_array($rstSelItem))
					         {						   
						   $itemId=$rowSelItem['item_id'];
						   $productId=$rowSelItem['product_id'];
						   $pro = getProductById($productId);
						   $productName=$pro['product_name'];
						   if($productName=='')
							$productName='-';
						   $ownerId=$rowSelItem['owner_id'];
						   $price=$rowSelItem['price'];
						   //echo $price;
						   $commission=$rowSelItem['commission'];
						   $productQuantity="0";
						   $productQuantity=$pro['quantity'];
						   if($productQuantity=="")
						     $productQuantity=0;
						  
						   $productInfo=getProductById($rowSelItem['product_id']);
						   $bargainDate = $productInfo['bargain_duration'];
						   $productShipping = $productInfo['shipping'];
						   $bargainDate=$rowSelItem['bargain_duration'];
						   if(!empty($productShipping))
						    $productShipping=$productShipping;
						   else
						     $productShipping="Free";
						   
						   $productProCondition=$pro['pro_condition'];
						   
						   if($productProCondition=="")
						    $productProCondition="-";
						   
						   $pos=strstr($productShipping,"Free");
						   if($pos===FALSE)
						   {
							$productShipping."$".number_format($productShipping,2);
						   }
						    $productSellingType="&nbsp";
						    $productSellingType=$pro['selling_type'];
						   
						   if($productSellingType=="")
						      $productSellingType="-";
						   
						   
						     $editItem="<a href='javascript:void(0);' onClick='funEditProductOtherForm($itemId)'>Edit</a>";
						     $deleteItem="<a href='javascript:void(0);' onClick=funDelProOthers('frmProListOthers','item',$itemId)>Delete</a>";
						     $timeLeft = getRemainingTime($bargainDate);
						   if($timeLeft <= 0) {
						   		$timeLeft = '&nbsp;<a href="javascript:void(0);" id="relist_cf_'.$itemId.'" class="yellow_btn" style="text-decoration:none; float:none; padding:5px 5px 5px 5px; height:15px;" onclick="show_cf_box('.$itemId.')">Re-List</a>';
						    }
						    ?>
							<div style="float:left; width:659px; border-bottom:1px solid #ccc; margin:3px 0px 3px;  background:#F9F7F7;">
								<div style="width: 25px; text-align:center;" class="cell_row"><?php echo $r;?></div>
								<div style="width: 90px; text-align:center;" class="cell_row"><a href="index.php?SellProduct=<?php echo $productId;?>" title="<?php echo $productTitle;?>"><?php echo $productName; ?></a></div>
								<div style="width: 70px; text-align:center;" class="cell_row"><?php echo $productProCondition;?></div>
								<div style="width: 50px; text-align: center;" class="cell_row"><?php echo $productSellingType;?></div>
							       
								<div style="width: 35px; text-align: center;" class="cell_row"><?php echo $productQuantity?></div>
								<div style="width: 80px; text-align: center;" class="cell_row">$<?php echo number_format($commission,2);?></div>
								<div style="width: 57px; text-align: center;" class="cell_row">$<?php echo number_format($productShipping,2);?></div>
								<div style="width: 65px; text-align: center;" class="cell_row">$<?php echo number_format(round($price,2),2);?></div>
								<div style="width: 105px; text-align: center;" class="cell_row"><?php echo $timeLeft;?></div>
								<div style="width: 40px; text-align:center;" class="cell_row"><?php //echo $editItem;?> <?php echo $deleteItem;?></div>
							</div>
						    <?
						   
						 	$r++;
						 } ?>
						
						</div>
		   <?php
		    
		  /* echo"<div style='float:left; width:660px;'><table width='100%' style='float:left;' border='0' align='center' cellspacing='0'><tr><td colspan='4'>
		    <a href='index.php?addProduct' class='yellow_btn' style='float: left; height: 22px; margin: 10px 10px 0px 180px; 
		   padding: 7px 5px 0px; text-decoration: none;''>Search Products to Sell</a>
		   <a href='seller_store.php?sid=$userId' class='sbmt_btn' style='float: left; height: 22px; margin: 10px 10px 0px 20px; 
		   padding: 7px 5px 0px; text-decoration: none;'>Customize Your Swapen Store</a>
		   </td></tr></table></div>";*/
		   
			$sqlChkStore = mysql_query("SELECT seller_store_id FROM tbl_seller_store WHERE seller_id='$userId'") or die(mysql_error());
			$c_sqlChkStore =  mysql_num_rows($sqlChkStore);
			if($c_sqlChkStore > 0)
			{
				$str = "<a href='javascript:void(0)' onclick='show_cus_swa_sto()' class='sbmt_btn' style='float: left; height: 22px; margin: 10px 10px 0px 20px; 
			     padding: 7px 5px 0; text-decoration: none;' id='cus_u_swa'>Customize Your Swapen Store</a>";
			}
			else
			{
				$str = "<a href='seller_store.php?sid=$userId' class='sbmt_btn' style='float: left; height: 22px; margin: 10px 10px 0px 20px; 
			   padding: 7px 5px 0px; text-decoration: none;'>Customize Your Swapen Store</a>";	
			}
		  
			echo"<div style='float:left; width:660px;'><table width='100%' style='float:left;' border='0' align='center' cellspacing='0'><tr><td colspan='4'>
			 <a href='index.php?addProduct' class='yellow_btn' style='float: left; height: 22px; margin: 10px 10px 0px 180px; 
			padding: 7px 5px 0px; text-decoration: none;''>Search Products to Sell</a>
			".$str."
			</td></tr></table></div>";
		   
		}						
	?>
	</form>
<tr>
	<td><div align="center "style="float:left; width:660px;"><?php
		   $link="mySwapen";
		   echo $disp=getPagingLink($sqlSelItem,$itemPerPage,$link);
	 ?></div></td>
</tr>
<tr>
<td>
<tr>
  <td>
  <a name="editOthers" id="editOthers">
  <?php
  if(!empty($_POST['hidEditSellingItemothers'])) {
    $sqlSelLstEdit="SELECT * FROM tbl_items where item_id=".$_POST['hidEditSellingItemothers'];
    $rstSelLstEdit=mysql_query($sqlSelLstEdit);
	$rowSelLstEdit=mysql_fetch_array($rstSelLstEdit);
	$productInfo=getProductById($rowSelLstEdit['product_id']);
  ?>
   <div id="divEditWishlist">
    <form name="frmEditSellingProduct" id="frmEditSellingProduct" method="post" action="">
    <input type="hidden" name="editSellingProductOtherKey" id="editSellingProductOtherKey" />
      <table width="100%" border="0">
        <tr  class='head-tr'>
          <td colspan="3"><strong>Edit product commission</strong></td>
        </tr>
        <tr>
          <td height="29">&nbsp;</td>
          <td width="21%"><strong>Product</strong></td>
          <td width="77%"><span class="style1">
            <?php if(!empty($productInfo['product_name']))
			echo $productInfo['product_name'];
			?>
          </span></td>
        </tr>
        <tr>
          <td height="31">&nbsp;</td>
          <td><strong>Comission (PP)</strong></td>
          <td><input type="text" name="commission" id="commission" size="33" value="<?php if(!empty($rowSelLstEdit['commission']))
			echo $rowSelLstEdit['commission'];
			?>"/></td>
        </tr>
        <tr>
          <td height="34">&nbsp;</td>
          <td>&nbsp;</td>
          <td><label>
            <input type="button" name="editSellingProduct" id="editSellingProduct" value="Edit product" onclick="funEditSellingProductOther(<?php  if(!empty($_POST['hidEditSellingItemothers'])) echo $_POST['hidEditSellingItemothers'];?>)" />
          </label></td>
        </tr>
      </table>
      </form>
    </div></td>
    <?php } ?>
</tr>
<tr>
    <td colspan="2"></td>
</tr>

<?
if($_SESSION['user_id_sess']=="68")
{
?>

<tr class='head-tr'>
    <td><strong>Swapenbuddy list</strong></td>
</tr>
<tr>
    <td>		
		
		 <form name="frmProListOwn" id="frmProListOwn" method="post" action="">
		 	
		 <?php		   
				//delete single product		 
		
				   $sqlSelPro="SELECT * FROM tbl_product WHERE posted_date < DATE_ADD(CURDATE(),INTERVAL -2 DAY) AND product_id NOT IN ( SELECT product_id FROM tbl_items where seller_id!='68' ) ORDER BY posted_date DESC";
				   $rstSelPro=mysql_query(getPagingQuery($sqlSelPro,$itemPerPage));				  
				   $num=mysql_num_rows($rstSelPro);
				   if($num==0)
					{
					  echo "<div style='border-top:1px solid #CCCCCC;'> </div><br>";
					  echo "<p style='padding:5px;'>No items found on your list...</p><br>";
					  echo "<div style='border-top:1px solid #CCCCCC;'> </div><br>";
					}
				   else {
					    
					?>
					
				   		  <br><table width='100%' border='0' align='center' cellspacing='0'>
						  <tr class='head-tr'>
                          		  <td width="3%">&nbsp;</td>	
				    	    <td width="5%"><strong>S.No</strong></td>								
								  <td width="15%"><strong>Product name </strong></td>
								  <td width="10%"><strong>Condition</strong></td>
								  <td width="9%"  align='center'><strong># of Sellers</strong></td>
								  <td width="7%"><strong>Pick up</strong></td>
								  <td width="6%"><strong>Qty</strong>.</td>
								  <td width="11%"  align='center'> <strong> Comission (PP)</strong></td>
								  <td width="7%"  align='center'> <strong>Price</strong></td>								  
								  <td width="8%"  align='center'> <strong>Shipp (PP)</strong></td>
							      <td width="19%">&nbsp;</td>
							      <div style="display:none;" id="divAddItemToSeller"></div>
						    </tr>				 
						 <?php
						 $r=1;
						 while($rowSelPro=mysql_fetch_array($rstSelPro))
					        {
							
						   $productId=$rowSelPro['product_id'];
						   
						    $sqlselitem=mysql_query("select * from tbl_items WHERE seller_id='68' and product_id='$productId'") or die(mysql_error());
						     $noselitem=mysql_num_rows($sqlselitem);
						   
						   if($noselitem==0)
						   {
							 //echo  $noselitem;
						?>
							<script>
							    funAddItem('<?php echo $productId; ?>','<?php echo $_SESSION['user_id_sess']; ?>','divAddItemToSeller','30');
							</script>
						<?php
						
						    }
						  					   
						   $productName=wordFormater($rowSelPro['product_name'],10);
						   $productTitle = $rowSelPro['product_name'];					   
						   $productPrice=$rowSelPro['product_price'];
						   
						   $productThumb=$rowSelPro['product_thumbnail'];
						   $productImage=$rowSelPro['product_image'];
						   $productSellingType=$rowSelPro['selling_type'];
						   $productShipping=$rowSelPro['shipping'];
						   $productProCondition=$rowSelPro['pro_condition'];
						   $productQuantity=$rowSelPro['quantity'];
						   $commission=$rowSelPro['commission'];
						   $postedBy=$rowSelPro['posted_by'];
						   $postedDate=$rowSelPro['posted_date'];
						   $bargainDate = $rowSelPro['bargain_duration'];
						   if(!empty($productShipping))
						    $productShipping=" + ".$productShipping;
						   else
						     $productShipping=" + Free";
						   $timeLeft = getRemainingTime($bargainDate);
						   if($timeLeft < 0) {
						   		$timeLeft = "<font color='red'>Listing Expired</font>";
						    }
						  $sqlSelNoSeller="SELECT * FROM tbl_items where product_id='$productId'  and seller_id!='$userId'";
				   		  $rstSelNoSeller=mysql_query($sqlSelNoSeller);				
				   		  $numSelNoSeller=mysql_num_rows($rstSelNoSeller);
						  if($numSelNoSeller<=1)
						   $imageExpand="<b><font color='#0000CC'>-</font></b>";
						  else
						   $imageExpand="<a href='javascript:void(0);' onClick='funExpandProduct($productId,\"mchnt\",\"divSellingPro$productId\",$r)'><img src='images/16x16x+.jpg'  border='0'></a>";
						   echo "<tr>
						   <td colspan='10'>
						   <div  id='divSellingPro$productId'>
						   <table width=100% border='0' align='center' cellspacing='0'>
						   <tr>
						    	 <td width='5%' align='center'>$imageExpand</td>	
						   		 <td  width='3%' height='28'> $r </td>					         
								 <td  width='15%'><a href='index.php?SellProduct=$productId' title='$productTitle'> $productName </a></td>
								 <td width='10%'>$productProCondition</td>";
								 
							if($numSelNoSeller!=0)
								echo"<td  width='9%' align='center'><a href='javascript:void(0);' onClick=window.location='index.php?editSellingProduct=$productId'>$numSelNoSeller</a></td>";
							else
								echo"<td  width='9%' align='center'>$numSelNoSeller</td>";
							 
							echo"<td  width='7%'>$productSellingType</td>
								 <td width='6%' align='center'>$productQuantity</td>
								 <td width='11%'  align='right'>$$commission </td>
								 <td align='right' width='15%'> $$productPrice  </td>
								 <td align='right' width='15%'> $$productShipping </td>
						      	 <td  width='19%'>&nbsp;</td>
						  </tr>
						</table>
						</div>
						</td>
						</tr>";
					    echo "<tr><td colspan='10'> <div style='border-top:1px solid #CCCCCC;'> </div> </td></tr>";   			  
						 	$r++;
						 } ?>
						</table>	
                        <?php
						} 
		  
									
	?>
	</form>
	</td>
</tr>
<tr>
	<td><div align="center"><?php
		   $link="mySwapen";
		   echo $disp=getPagingLink($sqlSelPro,$itemPerPage,$link);							   
	 ?></div>
	</td>
</tr>
<?
}
?>
</table>
</div>
<div class="fullbox_bot">&nbsp;</div>
</div><br /><br />
<hr style="float:left; width:500px; display:none;" id="hr_line_sell_p_f_o_u" />
</div>

</div>
<br/>
<div class="popup_box" style="display:none; position:absolute; background:#FFFFFF;" id="custom_u_swapen_store"> 
  <div class="popup_box_in" style="height:120px;">
      <div style="float:left; width:95%; padding:5px;">
	<span style="float:right; cursor:pointer;" onclick="$('#custom_u_swapen_store').hide();">x</span>
      </div>
      <div style="float: left; margin: 0 30px; padding: 5px; text-align: center; width: 85%;">
	<h3>Please make your selection</h3>
      </div>
      <div style="float:left; width:98%; padding:5px;">
	  
			  &nbsp;&nbsp;&nbsp;&nbsp;
	  <?php
	  $sqlChkStore = mysql_query("SELECT seller_store_id FROM tbl_seller_store WHERE seller_id='$userId'") or die(mysql_error());
	  $c_sqlChkStore =  mysql_num_rows($sqlChkStore);
	  if($c_sqlChkStore > 0)
	  {
	    $rowSelStore = mysql_fetch_array($sqlChkStore);
	    $storeId = $rowSelStore['seller_store_id'];
	  ?>
	    <input type="button" id="proceedbtn" onclick="window.location='index.php?updstore=<?php echo $storeId;?>'" value="Edit Store" class="yellow_btn"  style="float:none; height:30px; cursor:pointer;" />
	     <input type="button" id="proceedbtn" value="Go to Store" class="yellow_btn" onclick="window.location='seller_store.php?sid=<?php echo $userId;?>'"  style="float:none; height:30px; cursor:pointer;" />
	  <?php
	  }
	  else
	  {	  
	  ?>
	    <input type="button" id="proceedbtn" onclick="window.location='index.php?updstore=<?php echo $storeId;?>'" value="Add Store" class="yellow_btn"  style="float:none; height:30px; cursor:pointer;" />
	  <?php } ?>
      </div>
  </div>
</div>
<script>
function show_cus_swa_sto()
{
  var ntop = (( $(window).height() - $('#cus_u_swa').height()) / 2+$(window).scrollTop()) - 100;
  var nleft = ( $(window).width() - $('#cus_u_swa').width()) / 2+$(window).scrollLeft();
  $('#custom_u_swapen_store').css({'left': '', 'top':ntop});
  $('#custom_u_swapen_store').fadeIn('slow');
}
</script>
<div id='panel'>
	 <?php require_once "own_products_sellers.php"; ?>
</div>
<?
} ?>